//
//  GameModel.h
//  CoreGraphicsTest
//
//  Created by aewatson on 11/19/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SpriteModel.h"

typedef enum {
    NOT_STARTED = 0,
    PAUSED = 1,
    PLAYING = 2,
    FINISHED = 3
} STATE;

static const float ACCELERATION = 100;  // gravity
static const int VIEW_WIDTH = 320;
static const int VIEW_HEIGHT = 284;
static const int STATE_INTERVAL = 8;
static const int BLOCK_POINTS = 5;
static const int BLOCK_INTERVAL_START = 2000;
static const int BLOCK_INTERVAL_INC = -400; // this id double for presentation
static const float BLOCK_INTERVAL_VAR_PERCENT = .3;
static const int BLOCK_SIZE_START = 20;
static const int BLOCK_SIZE_INC = -2; // this is doubled for presentation
static const int BLOCK_VELOCITY_X_START = 120;
static const int BLOCK_VELOCITY_X_INC = 10; // this is doubled for presentation
static const int BLOCK_VELOCITY_Y = -100;
static const int BLOCK_VELOCITY_VAR = 20;
static const int BLOCK_COUNT_START = 10;
static const int BLOCK_COUNT_INC = 10; // this is doubled for presentation

@class SpriteModel;

@interface GameModel : NSObject {
    NSMutableArray *blocks;
    NSMutableArray *shots;
    int viewWidth;
    int viewHeight;
    int blockInterval;
    int curBlockInterval;
    int curBlockStateInterval;
    int blockCount;
    int curBlock;
    int round;
    int score;
    int blocksHitCount;
    int velocityX;
    STATE state;
    bool lastBlock;
}

@property (nonatomic, retain) NSMutableArray *blocks;
@property (nonatomic, retain) NSMutableArray *shots;
@property (nonatomic, retain) NSMutableArray *explosions;
@property (nonatomic) int viewWidth;
@property (nonatomic) int viewHeight;
@property (nonatomic) STATE state;
@property (nonatomic) int blockInterval;
@property (nonatomic) int curBlockInterval;
@property (nonatomic) int curBlockStateInterval;
@property (nonatomic) int score;
@property (nonatomic) int round;
@property (nonatomic) int blockCount;
@property (nonatomic) int curBlock;
@property (nonatomic) bool lastBlock;
@property (nonatomic) int blocksHitCount;
@property (nonatomic) int velocityX;

-(id) init;
-(void) addBlock;
-(void) addExplosionWithBlock:(SpriteModel*) block;
-(void) addShotWithColor:(int) shotColor;
-(void) timerTickedAfterMilliseconds:(int) ms;
-(void) updateModelAfterMilliseconds:(int) ms;
+(float) getAcceleration;
-(bool) isModelVisible:(SpriteModel*) blockModel;
-(int) getNextBlockInterval;
-(void)initNextRound;
-(void)startRound;
-(void)endRound;
-(NSString*)getStatus;
-(NSString*)getSummary;
-(NSString*)getScoreString;
-(NSString*)getRoundString;
-(int) getVelocityY;
-(int) getVelocityY;

@end
